package com.glory.hzlionpda.bean;

import android.content.Context;
import android.widget.Toast;

import com.pda.platform.ui.ui_pdaplatform.utils_public.FreeApi_ToastUtils;

import java.io.Serializable;

/**
 * @author anyang
 * @date 2017/9/12
 * @desc
 */

public class BaseBean implements Serializable {
    private String RESULTCODE;
    private String RESULTMESSAGE;

    public String getRESULTMESSAGE() {
        return RESULTMESSAGE == null ? "" : RESULTMESSAGE;
    }

    public void setRESULTMESSAGE(String RESULTMESSAGE) {
        this.RESULTMESSAGE = RESULTMESSAGE;
    }

    //获取到对象后，必须要判断是否获取成功
    public boolean isSuccess(Context context) {
        if (getResultCode().equalsIgnoreCase("true")) {
            return true;
        } else {
            FreeApi_ToastUtils.showFreeToast(RESULTMESSAGE, context, false, Toast.LENGTH_SHORT);
            return false;
        }
    }

    public String getResultCode() {
        return RESULTCODE == null || RESULTCODE.length() == 0 ? "false" : String.valueOf(RESULTCODE);
    }

    public void setResultCode(String resultCode) {
        this.RESULTCODE = resultCode;
    }
}
